package javawdw.security.entity;

import java.util.Date;

import javawdw.security.util.DateJsonSerializer;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.springframework.security.core.GrantedAuthority;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Role implements GrantedAuthority {
	private static final long serialVersionUID = 1L;
	private String id;
	private String authority;
	private int level;
	private String nickname;
	private Date updateTime;
	
	public Role() {
		this.updateTime = new Date();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@JsonSerialize(using = DateJsonSerializer.class)
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
}
